package com.pk.android.view;

import java.util.ArrayList;
import java.util.List;

import android.os.Bundle;
import android.view.Menu;

import com.pk.android.R;
import com.pk.android.dummy.temp_source;
import com.pk.android.model.BaseFragment;
import com.pk.android.model.League;


public class MyLeaguesActivity extends GeneralDrawerActivity
implements 	MyLeaguesFragment.OnAllLeaguesClickListener, 
			DashboardPK_Fragment.OnMyLeagueClickListener{
	
	private String title = "MY LEAGUE";
	List<BaseFragment> fragments;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	
		//final ActionBar actionBar = getSupportActionBar();
		fragments = getFragments();
		SetupPageViewer(fragments, title);
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public void onAllLeaguesClick(int position) {
	
	}
	

	@Override
	public void onMyLeaguesClick(int position) {
		SetPagerCurrentItem(position);
	}
	
	private List<BaseFragment> getFragments(){
		  List<BaseFragment> fList = new ArrayList<BaseFragment>();
		  for(League item : temp_source.getMyLeagueList())
			  fList.add(MyLeaguesFragment.newInstance(item.getName()));
		  return fList;
	}
	
}


